package org.android.brasil.projetos.oktoberfest2011.view;

import org.android.brasil.projetos.oktoberfest2011.R;
import org.android.brasil.projetos.oktoberfest2011.utils.AnalyticsUtils;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TabHost;

public class HorariosTabView extends TabActivity {

	private TabHost tabHost;
	private boolean mostrarDesfile;
	private AnalyticsUtils mGa;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		this.mGa = AnalyticsUtils.getInstance(this);
		
		setContentView(R.layout.horarios_tab_view);


		bindScreenFields();
		populateFields();
		
		this.mGa.trackScreen(getString(R.string.horario));

	}

	private void bindScreenFields() {
		tabHost = getTabHost();
	}

	private void populateFields() {

		mostrarDesfile = getIntent().getBooleanExtra("DESFILE", false);
		
		TabHost.TabSpec spec;
		Intent intent = new Intent().setClass(this, HorarioView.class);
		String set  = getResources().getString(R.string.apresentacoes);
		spec = tabHost.newTabSpec(set)
				.setIndicator(set, getResources().getDrawable(R.drawable.apresentacoes))
				.setContent(intent);

		tabHost.addTab(spec);

		
		TabHost.TabSpec spec1;
		Intent intent1 = new Intent().setClass(this, DesfilesView.class);

		String set1  = getResources().getString(R.string.desfiles);
		spec1 = tabHost.newTabSpec(set1)
				.setIndicator(set1, getResources().getDrawable(R.drawable.desfile))
				.setContent(intent1);

		tabHost.addTab(spec1);
		
		if(mostrarDesfile){
			tabHost.setCurrentTab(1);
		}

	}
	
	protected void onDestroy() {
		super.onDestroy();
	}
}
